#include"ClassMate.hh"


ClassMate::ClassMate(){};

ClassMate::ClassMate(std::string name, uint64_t id, bool isGirl)
{
  std::cout<< "Begin of >>>>>>>>>>>constructing ClassMate object"<<std::endl;
  m_name=name;
  m_id = id;
  m_isGirl= isGirl;
  m_previousClassMate=nullptr;
  m_nextClassMate=nullptr;
  std::cout<< "end of <<<<<<<<<<<<<constructing ClassMate object"<<std::endl;	
}
  

void ClassMate::printInfo(){
  if(m_previousClassMate!=nullptr and m_nextClassMate!=nullptr){
    std::cout<<"name "<< m_name
	     <<" id "<< m_id
	     <<" isGirl" << m_isGirl <<", previous = " << (*m_previousClassMate).m_name <<", next = " << (*m_nextClassMate).m_name <<std::endl;
  } else if(m_previousClassMate!=nullptr and m_nextClassMate==nullptr){
    //std::cout<<"no next classMate "<< std::endl; 
    std::cout<<"name "<< m_name
	     <<" id "<< m_id
	     <<" isGirl" << m_isGirl <<", previous = " << (*m_previousClassMate).m_name <<", no next classMate " <<std::endl;
  } else if(m_previousClassMate==nullptr and m_nextClassMate!=nullptr){
    //std::cout<<"no previous classMate "<< std::endl; 
    std::cout<<"name "<< m_name
      	     <<" id "<< m_id
	     <<" isGirl" << m_isGirl <<", no previous classMate, next = " << (*m_nextClassMate).m_name <<std::endl;
  } else {
    throw std::runtime_error("Neither previous classMate nor next classMate. This should not happen");
  }
}
